package com.feinno.urcs.group.entity;

import com.feinno.database.DataRow;
import com.feinno.superpojo.SuperPojo;
import com.feinno.superpojo.annotation.Field;
import com.feinno.urcs.profile.entity.ClientType;
import com.feinno.urcs.types.MobileNo;

import java.sql.SQLException;
import java.util.Date;

/**
 * @author Li.Hongbo <lihongbo@feinno.com>
 */
public class GroupTextMessageStorageEntity extends SuperPojo {
    @Field(id = 1)
    private long groupMessageId;
    @Field(id = 2)
    private int groupId;
    @Field(id = 3)
    private MobileNo sender;
    @Field(id = 4)
    private boolean messageBarcycle;
    @Field(id = 5)
    private String messageContentType;
    @Field(id = 6)
    private byte[] textContent;
    @Field(id = 7)
    private String textContentType;
    @Field(id = 8)
    private String textContentDisposition = "";
    @Field(id = 9)
    private String textContentTransferEncoding = "";
    @Field(id = 10)
    private String textImdnMessageId = "";
    @Field(id = 11)
    private String textImdnDispositionNotification = "";
    @Field(id = 12)
    private Date textDateTime;
    @Field(id = 13)
    private ClientType messageClientType;

    public GroupTextMessageStorageEntity() {
    }

    public GroupTextMessageStorageEntity(DataRow dr) throws SQLException {
        setGroupMessageId(dr.getLong("group_message_id"));
        setGroupId(dr.getInt("groupId"));
        setSender(MobileNo.parseFrom(dr.getString("sender")));
        setMessageBarcycle(dr.getBoolean("message_barcycle"));
        setMessageContentType(dr.getString("message_content_type"));
        setTextContent(dr.getBytes("text_content"));
        setTextContentType(dr.getString("text_content_type"));
        setTextContentDisposition(dr.getString("text_content_disposition"));
        setTextContentTransferEncoding(dr.getString("text_content_transfer_encoding"));
        setTextImdnMessageId(dr.getString("text_imdn_message_id"));
        setTextImdnDispositionNotification(dr.getString("text_imdn_disposition_notification"));
        setTextDateTime(dr.getDateTime("text_dateTime"));
        setMessageClientType(ClientType.parse(dr.getInt("client_type")));


    }


    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }

    public MobileNo getSender() {
        return sender;
    }

    public void setSender(MobileNo sender) {
        this.sender = sender;
    }

    public boolean getMessageBarcycle() {
        return messageBarcycle;
    }

    public void setMessageBarcycle(boolean messageBarcycle) {
        this.messageBarcycle = messageBarcycle;
    }

    public String getMessageContentType() {
        return messageContentType;
    }

    public void setMessageContentType(String messageContentType) {
        this.messageContentType = messageContentType;
    }

    public byte[] getTextContent() {
        return textContent;
    }

    public void setTextContent(byte[] textContent) {
        this.textContent = textContent;
    }

    public String getTextContentType() {
        return textContentType;
    }

    public void setTextContentType(String textContentType) {
        this.textContentType = textContentType;
    }

    public String getTextContentDisposition() {
        return textContentDisposition;
    }

    public void setTextContentDisposition(String textContentDisposition) {
        this.textContentDisposition = textContentDisposition;
    }

    public String getTextContentTransferEncoding() {
        return textContentTransferEncoding;
    }

    public void setTextContentTransferEncoding(String textContentTransferEncoding) {
        this.textContentTransferEncoding = textContentTransferEncoding;
    }

    public String getTextImdnMessageId() {
        return textImdnMessageId;
    }

    public void setTextImdnMessageId(String textImdnMessageId) {
        this.textImdnMessageId = textImdnMessageId;
    }

    public String getTextImdnDispositionNotification() {
        return textImdnDispositionNotification;
    }

    public void setTextImdnDispositionNotification(String textImdnDispositionNotification) {
        this.textImdnDispositionNotification = textImdnDispositionNotification;
    }

    public Date getTextDateTime() {
        return textDateTime;
    }

    public void setTextDateTime(Date textDateTime) {
        this.textDateTime = textDateTime;
    }

    public long getGroupMessageId() {
        return groupMessageId;
    }

    public void setGroupMessageId(long groupMessageId) {
        this.groupMessageId = groupMessageId;
    }

    public ClientType getMessageClientType() {
        return messageClientType;
    }

    public void setMessageClientType(ClientType messageClientType) {
        this.messageClientType = messageClientType;
    }
}
